{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pixels and their neighbours: Finite volume\n",
    "\n",
    "*Rowan Cockett, Lindsey Heagy and Doug Oldenburg*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This notebook uses [Python 2.7](https://docs.python.org/2/) and the open source package [SimPEG](http://simpeg.xyz). [SimPEG](http://simpeg.xyz) can be installed using the python package manager PyPi and running: \n",
    "\n",
    "\n",
    "```\n",
    "pip install SimPEG\n",
    "```\n",
    "\n",
    "Alternatively, these notebooks can be run on the web using binders\n",
    "\n",
    "[![Binder](http://mybinder.org/badge.svg)](http://mybinder.org:/repo/simpeg/tle-finitevolume)\n",
    "\n",
    "This tutorial consists of 3 parts, here, we introduce the problem, in [divergence.ipynb](divergence.ipynb) we build the discrete divergence operator and in [weakformulation.ipynb](weakformulation.ipynb), we discretize and solve the DC equations using weak formulation. \n",
    "\n",
    "**Contents**\n",
    "- [DC Resistivity setup](#DC-Resistivity)\n",
    "- [mesh](mesh.ipynb)\n",
    "- [divergence](divergence.ipynb)\n",
    "- [weakforulation](weakformulation.ipynb)\n",
    "- [all together now](all_together_now.ipynb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DC Resistivity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"./images/DCSurvey.png\" width=60% align=\"center\">\n",
    "\n",
    "<h4 align=\"center\"> Figure 1. Setup of a DC resistivity survey.</h4>\n",
    "\n",
    "DC resistivity surveys obtain information about subsurface electrical conductivity, $\\sigma$. This physical property is often diagnostic in mineral exploration, geotechnical, environmental and hydrogeologic problems, where the target of interest has a significant electrical conductivity contrast from the background. In a DC resistivity survey, steady state currents are set up in the subsurface by injecting current through a positive electrode and completing the circuit with a return electrode. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Deriving the DC equations\n",
    "\n",
    "<img src=\"images/DCEquations.png\" width=70% align=\"center\">\n",
    "<h4 align=\"center\">Figure 2. Derivation of the DC resistivity equations</h4>\n",
    "\n",
    "Conservation of charge (which can be derived by taking the divergence of Ampere’s law at steady state) connects the divergence of the current density everywhere in space to the source term which consists of two point sources, one positive and one negative. The flow of current sets up electric fields according to Ohm’s law, which relates current density to electric fields through the electrical conductivity. From Faraday’s law for steady state fields, we can describe the electric field in terms of a scalar potential, $\\phi$, which we sample at potential electrodes to obtain data in the form of potential differences."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The finish line\n",
    "*Where are we going??* \n",
    "\n",
    "Here, we are going to do a run through of how to setup and solve the DC resistivity equations for a 2D problem using [SimPEG](http://simpeg.xyz). This is meant to give you a once-over of the whole picture. We will break down the steps to get here in the series of notebooks that follow..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "//anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.\n",
      "  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10da07290>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Import numpy, python's n-dimensional array package,\n",
    "# the mesh class with differential operators from SimPEG\n",
    "# matplotlib, the basic python plotting package\n",
    "import numpy as np\n",
    "from SimPEG import Mesh, Utils  \n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "plt.set_cmap(plt.get_cmap('viridis')) # use a nice colormap!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Mesh\n",
    "\n",
    "Where we solve things! See [mesh.ipynb](mesh.ipynb) a discussion of how we construct a mesh and the associated properties we need. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The mesh has 8000 cells.\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEPCAYAAABY9lNGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHDdJREFUeJztnW+sbFd5n5/XJg4puLbAldUYG7cQagXFsVJwXMWqtkNU\nrvPFCVIbbNXRRUGy2hI1n0Ko2jpqFAGRqjopbdFFLk5oI1eKq9qhIECIpYiEPxeptvPHF2yIHfva\noYVA1ERBuXHffpjZPtvDzLlz9rl71m/t+T3SyGvN/M46j957fNZZa+09E5mJMcYYs8pFtQWMMcZo\n4gnCGGPMWjxBGGOMWYsnCGOMMWvxBGGMMWYtniCMMcasZdIJIiLujYivRsSjh2R+JSIej4iHI+KG\nKX2MMcZsz9QriA8Cb970YkTcCrwmM78HuAt4/8Q+xhhjtmTSCSIzPw1845DIbcCvLbOfAy6LiCun\ndDLGGLMdtc8grgKeHvTPLp8zxhhTmdoThDHGGFFeUvn7nwWuHvRftXzu24gIv2mUMcaMIDNjzNft\nYgURy8c6HgJ+EiAibgK+mZlf3TRQZr7wgPO355u7W9Cpfi22HU/HvX4t5luz6WrRXs3GM+kKIiJ+\nHeiAV0bEHwF3A5cAmZmnMvMjEfGjEfEE8OfA2w4fb3N/U3ueuScFnTRqse140zq1VYt51mzaWrRW\ns7FMOkFk5h1bZN6x/XgH7YiD/qb2PuQUndRzik7qOUUn9ZyS01h8SN0kJ2sLCHGytoAQJ2sLCHGy\ntsAsiOPuUe2KxSF1G67GGKNDkMKH1BeMzIPHsL+pPd9cEXSqX4ttx9Nxr1+L+dZsulq0WLOxNDVB\nGGOM2R3eYjLGmFkzfoup9o1yR2I4l6lcHVA7p+iknlN0Us8pOqnnlJzG4i2mJim1BYQotQWEKLUF\nhCi1BWZBUyuI1Zlw2N/U3oecopN6TtFJPafopJ5TcRpLU2cQQ1eVpVvtn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KGeMMWYt\naltMxhhjRPAEYYwxZi2eIIwxxqzFE4Qxxpi1eIIwxhizFk8Qxhhj1uIJwpgLwPItpb8REXO8Oc/s\nKZ4gjLkw/BLwj2tLGHMh8QRhzBGIiDcsP6Dpkoh42fIDeb43Mz8F+A3gzKyQeqsNY9TJzC9ExIMs\n3gDuu4APzfFtLIwBTxDGjOEXWLxR3F+w+JAiY2aJt5iMOTpXAC9n8QllL63sYsxkeIIw5ui8H/iX\nwH9lcTjdc9jbLRvTHN5iMuYILD++8y8z8/6IuAj47YjogH8D/B3g5cu3W/6pzPxERVVjjo3f7tsY\nY8xavMVkjDFmLZ4gjDHGrMUThDHGmLV4gjDGGLMWTxDGGGPW4gnCGGPMWjxBGGOMWYsnCGOMMWv5\n/3/PQrNCJpyjAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x103de66d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Define a unit-cell mesh\n",
    "mesh = Mesh.TensorMesh([100, 80])  # setup a mesh on which to solve\n",
    "print(\"The mesh has {nC} cells.\".format(nC=mesh.nC))\n",
    "\n",
    "mesh.plotGrid()\n",
    "plt.axis('tight');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Physical Property Model\n",
    "\n",
    "Define an electrical conductivity ($\\sigma$) model, on the cell-centers of the mesh. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x10dc36d90>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWkAAAEbCAYAAAAYkXWEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG1dJREFUeJzt3X2UXVWZ5/HvL+E1GNIpIEASEiHhxU7zokJg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y7boUuDMi1gFExOYh\njrFZZdq0ARibvx4LvBQRu4YwxqZF48Ui3ZYr6kotSQ/HxS9l2lTrT4B7Ko2oPRq2S9JE4KMR8S1a\nvMI9hMp8v44DeiTdJ2mhpMuGLLrBKdOmbwMzJK0HFgPXDlFsVeq2XFGXF7MkRNLZwBVkf8YNB18H\nasc/uyVRN7IP8C7gHOAg4CFJD0XEis6G1ZLPAYsj4mxJ04CfSDopIrZ3OrCRLrUk3dbFL4ko0yYk\nnQTMBmZFRMvr/YdAmXadCsyVJLJxzvMl7YyI+UMU42CUaddaYHNEvA68Lul+4GSycd8UlWnTmcCX\nACJipaRVwAnAo0MSYTW6LVfUldpwx57FL5L2I1v80v8/9HzgEwADLX5JSMM2SZoC3AlcFhErOxDj\nYDRsV0Qck29Hk41LfzrxBA3lfgbvBt4rabSkMWQXpVJetlemTUuBcwHycdvjgOeGNMrBGWixSLfl\nirqS6klHRK+k3YtfRgE3R774JTscsyPih5IuyBe/vEY2PJCsMm0CPg/0AH+X9zp3RsTMzkXdWMl2\n7XXKkAc5CCV/BpdJ+jHwJNALzI6IZzoY9oBKfq++DMyRtJgs6V0XEVs6F3Vj+WKRs4BDJD1PNkNl\nP7o0VxTxYhYzs4SlNtxhZmY1nKTNzBLmJG1mljAnaTOzhDlJm5klzEnazCxhTtJmZglzkjYzS5iT\ntHUdSafmD0jYT9JB+Y33f7PTcZlVwSsOrStJ+iJwYL6tiYivdjgks0o4SVtXkrQv2Y2D/h/wnvAP\nsg1THu6wbnUo8Dayp4gc0OFYzCrjnrR1JUl3A7cDRwMTI+LqDodkVomkblVqVkb+uKo3ImKupFHA\ng5LOioifdzg0s7ZzT9rMLGEekzYzS5iTtJlZwpykzcwS5iRtZpYwJ2kzs4Q5SZuZJcxJ2swsYU7S\nZmYJ+/8wsdsJ1/gIawAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10da4c850>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# model parameters\n",
    "sigma_background = 1.  # Conductivity of the background, S/m\n",
    "sigma_block = 10.  # Conductivity of the block, S/m\n",
    "\n",
    "# add a block to our model\n",
    "x_block = np.r_[0.4, 0.6]\n",
    "y_block = np.r_[0.4, 0.6]\n",
    "\n",
    "# assign them on the mesh\n",
    "sigma = sigma_background * np.ones(mesh.nC)  # create a physical property model \n",
    "\n",
    "block_indices = ((mesh.gridCC[:,0] >= x_block[0]) & # left boundary\n",
    "                 (mesh.gridCC[:,0] <= x_block[1]) & # right boundary\n",
    "                 (mesh.gridCC[:,1] >= y_block[0]) & # bottom boundary\n",
    "                 (mesh.gridCC[:,1] <= y_block[1]))  # top boundary\n",
    "\n",
    "# add the block to the physical property model\n",
    "sigma[block_indices] = sigma_block\n",
    "\n",
    "# plot it!\n",
    "plt.colorbar(mesh.plotImage(sigma)[0])\n",
    "plt.title('electrical conductivity, $\\sigma$')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define a source\n",
    "\n",
    "Define location of the positive and negative electrodes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x10dbc7550>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWkAAAEbCAYAAAAYkXWEAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHIBJREFUeJzt3Xu4XVV57/HvL9wTQ0yAAElMhISLTbmoEDhiLSBK4KhB\naC3QYqFHpLVcnlYF7Tk+PsenHrXiqSJWCdIcUSCWREy0ohFFOVCg4ZIAIZEkxJD7hQRCkgMke7/n\njzkTVlbW3Guuvdbca+61f5/nmU/WXHPMsd+x9s67xx5zjDkVEZiZWTkNancAZmaWzUnazKzEnKTN\nzErMSdrMrMScpM3MSsxJ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t2q1CyP\n9HFVr0fEdEmDgIcknRkRv2lzaGYt5560mVmJeUzazKzEnKTNzErMSdrMrMScpM3MSsxJ2sysxJyk\nzcxKzEnazKzEnKTNzErs/wMznZf8agdNygAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10dc187d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Define a source\n",
    "a_loc, b_loc = np.r_[0.2, 0.5], np.r_[0.8, 0.5]\n",
    "source_locs = [a_loc, b_loc]\n",
    "\n",
    "# locate it on the mesh\n",
    "source_loc_inds = Utils.closestPoints(mesh, source_locs)\n",
    "a_loc_mesh = mesh.gridCC[source_loc_inds[0],:]\n",
    "b_loc_mesh = mesh.gridCC[source_loc_inds[1],:]\n",
    "\n",
    "# plot it\n",
    "plt.colorbar(mesh.plotImage(sigma)[0])\n",
    "plt.plot(a_loc_mesh[0], a_loc_mesh[1],'wv', markersize=8) # a-electrode\n",
    "plt.plot(b_loc_mesh[0], b_loc_mesh[1],'w^', markersize=8) # b-electrode\n",
    "plt.title('electrical conductivity, $\\sigma$')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Assemble and solve the DC system of equations\n",
    "\n",
    "How we construct the divergence operator is discussed in [divergence.ipynb](divergence.ipynb), and the inner product matrix in [weakformulation.ipynb](weakformulation.ipynb). The final system is assembled and discussed in [play.ipynb](play.ipynb) (with widgets!)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# Assemble and solve the DC resistivity problem\n",
    "Div = mesh.faceDiv\n",
    "Sigma = mesh.getFaceInnerProduct(sigma, invProp=True, invMat=True)\n",
    "Vol = Utils.sdiag(mesh.vol)\n",
    "\n",
    "# assemble the system matrix\n",
    "A = Vol * Div * Sigma * Div.T * Vol\n",
    "\n",
    "# right hand side\n",
    "q = np.zeros(mesh.nC)\n",
    "q[source_loc_inds] = np.r_[+1, -1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from SimPEG import Solver # import the default solver (LU)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# solve the DC resistivity problem\n",
    "Ainv = Solver(A)  # create a matrix that behaves like A inverse\n",
    "phi = Ainv * q"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEbCAYAAAAlAxTiAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXuwZVV95z/f291IC0oQRkReKg2YIaJRQSo6GXzyCAmW\nVZOIUxpw4jA1Qa3JJD6mtDIzVSllyiRqSKIYpTQvTCA1oCMvIxPLRBx8gC9QulWkG2jTAhp5SPe9\nv/nj7HPuOvesddbeZ599zt67f5+qU3eftdde+7cf93fW+q7fWktmhuM4jtMPVpZtgOM4jjM/3Kk7\njuP0CHfqjuM4PcKduuM4To9wp+44jtMj3Kk7juP0CHfqjuM4PcKduuM4To9wp76fIum7kl6yoHN9\nXdIvLuJci6LsNS3yPjsOuFPvNZK+J+lhST+W9C/F3/fPsfxSDsvMfs7MPjtD+aH990q6XNLj52VX\nBTsmypv1mhynadyp9xsDfsnMnmhmTyj+vmlRJ5e0qWYRI/uB5wLPB95R27AOIOnnJW1bth1O93Cn\n3n+UzSAdKelKST+QtEPSGzfsP1rSVcX+f5b0fkkfA44FPlHUpH+7yPtdSW+RdBvwE0mbwppurKwy\n9pvZvcC1wM8V5fyspJskPSDpa5J+uUhP2ZW8xsK+/yrptqK8KyQdkCkvvKa3Stpe7P+6pFfm7nkJ\nTjKz7XMox9nPcKe+nyNJwCeArwBHAi8F3izp5cX+FeCTwHcZOLejgCvM7H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yq50DanHhustNHBpQYrtZUy1xTyG8C1\njVo0H7LXJempwCvN7E/pzro9ZZ7XicCTJN0k6RZJr12YdbNR5po+BJws6R7gNuDNC7KtSbrmK+aC\nDz5qEZJezCD650XLtmVOvBcI9duuOPYcm4HnAi8BDgI+L+nzZtbliVTeDtxmZi+WdDxwo6RTzOwn\nyzbMqUbbnPou4Njg+9FF2sY8x2TytIky14SkU4DLgLPMbFqTsi2Uua7nA1dIEgOd9mxJe83smgXZ\nOAtlrmsnsMfMHgUelfRZ4NkMdOs2UuaaXgj8HoCZ7ZD0XeCZwBcXYmEzdM1XzIW2yS+jwUqSDmAw\nWGmjA7gGeB2MRqxGByu1iOw1SToWuAp4rZl1ZYal7HWZ2TOKz9MZ6Or/ueUOHcq9g1cDL5K0SdLj\nGXTC3b5gO6tQ5ppuB14GUOjOJwLfWaiVsyHSLcCu+Yq50KqauvVwsFKZawLeCTwJ+JOiVrvXzDZO\nfNYqSl7X2CELN3IGSr6Dd0i6HvgqsApcZmbfXKLZUyn5rN4FXC7pNgZO8i1mdv/yrM4j6a+AM4DD\nJH2fQQTPAXTUV8wLH3zkOI7TI9omvziO4zg1cKfuOI7TI9ypO47j9Ah36o7jOD3CnbrjOE6PcKfu\nOI7TI9ypO47j9Ah36o7jOD3CnbrTOSQ9v1hQ5ABJBxULVfzrZdvlOG3AR5Q6nUTS/wS2Fp+7zeyS\nJZvkOK3AnbrTSSRtYTBR1SPAL5i/yI4DuPzidJfDgYMZrNJz4JJtcZzW4DV1p5NIuhr4a+DpwFPN\n7I1LNslxWkGrpt51nDIUy8c9ZmZXSFoB/lHSGWb2f5dsmuMsHa+pO47j9AjX1B3HcXqEO3XHcZwe\n4U7dcRynR7hTdxzH6RHu1B3HcXqEO3XHcZwe4U7dcRynR7hTdxzH6RH/H3ltKBwzYzcZAAAAAElF\nTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10daa5d10>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# look at the results!\n",
    "plt.colorbar(mesh.plotImage(phi)[0])\n",
    "plt.title('Electric Potential, $\\phi$');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## What just happened!?\n",
    "\n",
    "In the notebooks that follow, we will \n",
    "- define where variables live on the mesh ([mesh.ipynb](mesh.ipynb))\n",
    "- define the discrete divergence ([divergence.ipynb](divergence.ipynb))\n",
    "- use the weak formulation to define a solveable system of equations ([weakformulation.ipynb](weakformulation.ipynb))\n",
    "- solve and play with the DC resistivity equations ([all_together_now.ipynb](all_together_now.ipynb))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
